using AdminSG3L.Domain.Entities;

namespace AdminSG3L.Domain.Repositories;

/// <summary>
/// 权限仓储接口
/// </summary>
public interface IPermissionRepository : IRepository<AppPermission>
{
    /// <summary>
    /// 根据权限编码获取权限
    /// </summary>
    /// <param name="permissionCode">权限编码</param>
    /// <returns>权限实体</returns>
    Task<AppPermission?> GetByCodeAsync(string permissionCode);

    /// <summary>
    /// 获取权限树
    /// </summary>
    /// <returns>权限树结构</returns>
    Task<IEnumerable<AppPermission>> GetPermissionTreeAsync();

    /// <summary>
    /// 根据父权限ID获取子权限
    /// </summary>
    /// <param name="parentId">父权限ID</param>
    /// <returns>子权限列表</returns>
    Task<IEnumerable<AppPermission>> GetByParentIdAsync(Guid? parentId);
}
